package com.content.view.Component.Toggle
{
	import com.library.core.IDisposable;
	import com.library.core.UIObject;
	
	import flash.display.Sprite;
	
	public class ToggleGroupManager implements IDisposable
	{
		private var _activeItem:ToggleItemBase;
		private var _items:Array;
		
		public function ToggleGroupManager()
		{
			super();
			_items = new Array();
		}
		
		public function AddItem(item:ToggleItemBase):void{
			_items.push(item);
		}
		
		public function Clear():void{
			_items.length = 0;
		}
		
		public function ToggleItem(tItem:ToggleItemBase = null):void{
			if(_activeItem == tItem) return;
			var item:ToggleItemBase;
			for each(item in _items){
				if(item == tItem){
					_activeItem = item;
					item.Active = true;
				}else{
					item.Active = false;
				}
			}
		}
		
//		public function get Items():Array{
//			return _items;
//		}
		
		public function Dispose():void
		{
			Clear();
		}
	}
}